// main.c

#include "mystdio.h"
#include "mystring.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main()
{
    mFILE *fp = mfopen("log.txt", "w");
    if (fp == NULL)
    {
        return 1;
    }
    int cnt = 10;
    while(cnt--)
    {
        printf("write %d\n", cnt);
        char buffer[64];
        snprintf(buffer, sizeof(buffer), "hello xiaoc, cnt is : %d\n", cnt);
        mfwrite(buffer, strlen(buffer), fp);
        // mfflush(fp);
        sleep(1);
    }

    mfclose(fp);
    return 0;
}
